import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import { formatTimeAgoFn } from '@/utils/date'
// 导入全局组件并注册
import { Articleltem } from '@/components/Articleltem'
import { Button, Image, DatetimePicker, Tag, CellGroup, Divider, Search, Toast, NavBar, Popup, Dialog, Form, Field, Notify, PullRefresh, List, Tabbar, ActionSheet, Cell, TabbarItem, Icon, Tab, Tabs, Row, Col, Badge } from 'vant'

import 'amfe-flexible'
Vue.component('Articleltem', Articleltem)

Vue.prototype.formatTimeAgoFn = formatTimeAgoFn

Vue.use(Badge)
Vue.use(DatetimePicker)
Vue.use(Image)
Vue.use(Tag)
Vue.use(CellGroup)
Vue.use(Divider)
Vue.use(Search)
Vue.use(Row)
Vue.use(Col)
// 光标自动获取事件
Vue.directive('focus', {
  inserted (el) {
    console.log(el)
    el.querySelector('textarea').focus()
  }
})
Vue.directive('focu', {
  inserted (el) {
    console.log(el)
    el.querySelector('input').focus()
  }
})

Vue.use(Form)
Vue.use(Popup)
Vue.use(Toast)
Vue.use(Dialog)
Vue.use(Field)
Vue.use(NavBar)
Vue.use(Notify)
Vue.use(Tabbar)
Vue.use(TabbarItem)
Vue.use(Icon)
Vue.use(Tab)
Vue.use(Tabs)
Vue.use(Cell)
Vue.use(List)
Vue.use(ActionSheet)
Vue.use(PullRefresh)

Vue.config.productionTip = false

Vue.use(Button)
new Vue({
  router,
  store,

  render: h => h(App)
}).$mount('#app')
